// vue.config.js

const aliasExtned = require("./extends/alias.extend");
const routeExtend = require("./extends/route.extend");
const svgExtend = require("./extends/svg.extend");

module.exports = {
  lintOnSave: true,
  // 修改webpack配置
  chainWebpack: config => {
    // 别名扩展

    aliasExtned(config);
    // 路由扩展
    routeExtend(config);
    // svg扩展
    svgExtend(config);
  },
  configureWebpack: {
    module: {
      unknownContextCritical: false
    },
    externals: {
      "app-config": "appConfig"
    },
    optimization: {
      minimize: false
    }
  },
  devServer: {
    proxy: {
      "/api": {
        target: process.env.VUE_APP_SERVER_PROXY, // 如果使用代理，则需要在env文件配置
        ws: true, //代理websockets
        changeOrigin: true, // 是否跨域，虚拟的站点需要更管origin
        pathRewrite: {
          "^/api": "/"
        },
        logLevel: "info"
      }
    }
  },
  // 转换vuex-module-decorators to es5
  transpileDependencies: ["vuex-module-decorators"]
};
